import React from 'react'
import ReactDOM from 'react-dom/client'
import { RouterProvider } from 'react-router-dom'
import { Provider } from 'react-redux'
import { store } from './store'
import router from './router'
import { initFontAwesome } from './utils/fontawesome'
import './index.css'

// 初始化FontAwesome图标库
initFontAwesome();

// 添加错误处理
window.addEventListener('error', (event) => {
  console.error('全局错误捕获:', event.error);
});

// 添加Promise错误处理
window.addEventListener('unhandledrejection', (event) => {
  console.error('未处理的Promise拒绝:', event.reason);
});

console.log('开始渲染应用...');

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <Provider store={store}>
      <RouterProvider router={router} />
    </Provider>
  </React.StrictMode>,
);
